// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asTextBillboardComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the TextBillboardComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asTextBillboardComponent.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../ScriptHelper.h"
#include "asBillboardComponent.h"

#include "../../../components/scene/TextBillboardComponent.h"


//! Reference factory for the TextBillboardComponent class.
TextBillboardComponent* createTextBillboardComponent(Entity *parent)
{
    return new TextBillboardComponent(parent);
}

//! Reference factory for the TextBillboardComponent class.
TextBillboardComponent* createTextBillboardComponent(Entity *parent,
                                                     const std::string &fontFileName,
                                                     const std::string &text,
                                                     const dimension2df &size,
                                                     const SColor &colorTop,
                                                     const SColor &colorBottom)
{
    return new TextBillboardComponent(parent, fontFileName, text, size, colorTop, colorBottom);
}

//! Binds the TextBillboardComponent class to AngelScript.
void bindTextBillboardComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind TextBillboardComponent class.
    r = engine->RegisterObjectType("TextBillboardComponent", sizeof(TextBillboardComponent), asOBJ_REF); assert(r >= 0);

    // Bind inherited functions.
    bindBillboardComponentBase<TextBillboardComponent>(engine, "TextBillboardComponent");

    // Set TextBillboardComponent behaviour.
    r = engine->RegisterObjectBehaviour("TextBillboardComponent", asBEHAVE_FACTORY, "TextBillboardComponent@ f(Entity @+)",
                                        asFUNCTIONPR(createTextBillboardComponent, (Entity*), TextBillboardComponent*),
                                        asCALL_CDECL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("TextBillboardComponent", asBEHAVE_FACTORY, "TextBillboardComponent@ f(Entity @+, " \
                                        "const string &in, const string &in, const dimension2df &in, const SColor &in, " \
                                        "const SColor &in)", asFUNCTIONPR(createTextBillboardComponent,
                                        (Entity*, const std::string&, const std::string&, const dimension2df&,
                                        const SColor&, const SColor&), TextBillboardComponent*),
                                        asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("TextBillboardComponent", "TextBillboardComponent& opAssign(const TextBillboardComponent &in)",
                                     asFUNCTION(assignT<TextBillboardComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);

    // Bind TextBillboardComponent class functions.
    r = engine->RegisterObjectMethod("TextBillboardComponent", "void setText(const string &in)",
                                     asMETHODPR(TextBillboardComponent, setText, (const std::string&), void),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("TextBillboardComponent", "void setTextColor(const SColor &in)",
                                     asMETHOD(TextBillboardComponent, setTextColor), asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
